GetTelephoneNumber
Definition:
GetTelephoneNumber()
Description:
Obtain the telephone number of the device from the SIM card.
Platforms:
Android
Parameters:
none
Returns:
String containing the telephone number or "Unknown Number" if the SIM card hasn't got the telephone number recorded, there is no SIM card or the device has no telephony available. If an error occurs, an empty string is returned, "".
Notes:
This Method reads the value of the telephone number from the SIM card. Not all SIM cards come pre-configured with the telephone number in which case this Method will return the string "Unknown Number". In this situation, the device usually includes a setting to allow you to manually enter the number, after which this Method will return the number you enter.
To manually record your number, you will need to enter the number in the self-contact details under Contacts. The actual option has different names on different devices, such as Own Number or My Profile, but allows you to enter contact details for yourself, which usually includes your e-mail address and mobile phone number.
If you use this Method on Platforms other than Android, it will not generate an error but will always return an empty string, "".